package com.example.administrator.yuejian2.activity;

import android.content.Intent;
import android.os.Bundle;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.widget.TextView;

import com.example.administrator.yuejian2.R;
import com.example.administrator.yuejian2.RetrofitListener.RetrofitListener;
import com.example.administrator.yuejian2.adapter.TrainOrderDetailAdapter;
import com.example.administrator.yuejian2.bean.TrainOrderBean;
import com.example.administrator.yuejian2.model.TrainOrderDetailModel;

import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;

public class TrainOrderDetailActivity extends BaseActivity {

    private RecyclerView recyclerView;
    private TrainOrderDetailAdapter adapter;
    private RecyclerView.LayoutManager layoutManager;

    private String t_id;
    private RetrofitListener<List<TrainOrderBean>> listener;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_train_order_detail);
        recyclerView = findViewById(R.id.train_order_detail_recyclerview);
        layoutManager = new LinearLayoutManager(this);
        recyclerView.setLayoutManager(layoutManager);
        adapter = new TrainOrderDetailAdapter(this);
        recyclerView.setAdapter(adapter);
        Intent intent = getIntent();
        t_id = (String) intent.getStringExtra("null");
        listener= new RetrofitListener<List<TrainOrderBean>>() {

            @Override
            public void onSuccess(List<TrainOrderBean> list, int flag) {
                adapter.getTrainorderdetailList(list);
            }

            @Override
            public void onFail() {

            }
        };


        getTrainOrderDetail();
    }

    private void getTrainOrderDetail()
    {
        TrainOrderDetailModel trainOrderDetailModel=new TrainOrderDetailModel();
        trainOrderDetailModel.getTrainOrderDetail(t_id,listener);
    }
}
